package com.tuanzi.loan.business.entity.system;

import java.util.Date;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.tuanzi.loan.core.entity.AuditEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author Ray 2017/09/21
 */
@Data
@Entity
@Table(name = "TB_LOAN_ANNOUNCEMENT")
@EqualsAndHashCode(callSuper = true)
public class Announcement extends AuditEntity {

	private static final long serialVersionUID = 7502344866101762234L;

	@Id
	@Column(name = "ID")
	@GeneratedValue(generator = "uuid2")
	@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
	private String id;

	@NotBlank
	@Length(max = 2000)
	@Column(name = "CONTENT")
	private String content;

	@NotBlank
	@Length(max = 200)
	@Column(name = "TITLE")
	private String title;

	@NotNull
	@Column(name = "SEND_EMAIL")
	private Boolean sendEmail;

	@Column(name = "HAS_SEND_EMAIL")
	private Boolean hasSendEmail;

	@NotNull
	@Column(name = "START_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	private Date startTime;

	@NotNull
	@Column(name = "END_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	private Date endTime;

}
